package com.project.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.MessageBean;
import com.project.mapper.IMessageMapper;
import com.project.service.IMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MessageServiceImpl implements IMessageService {
    @Autowired
    private IMessageMapper messageMapper;
    @Override
    public void add(MessageBean mess) {
        messageMapper.add(mess);
    }

    @Override
    public void del(int id) {
        messageMapper.del(id);
    }

    @Override
    public void update(int id, String phone) {
        messageMapper.update(id,phone);
    }

    @Override
    public PageInfo<MessageBean> findByItem(int pageNO, String name, String job) {
        PageHelper.startPage(pageNO,PAGE_SIZE);
        PageInfo<MessageBean> info = PageInfo.of(messageMapper.findByItem(name,job));
        return info;
    }

    @Override
    public MessageBean findById(int id) {
        return messageMapper.findById(id);
    }
}
